//
//  CSFullNavVC.m
//  CreateWithSuper
//
//  Created by chenjunbo on 2024/8/3.
//  Copyright © 2024 CS. All rights reserved.
//

#import "CSFullNavVC.h"
#import "ADModule.h"

@interface CSFullNavVC ()

@property (weak, nonatomic) IBOutlet UIView *navView;
@property (weak, nonatomic) IBOutlet UILabel *timerLabel;
@property (weak, nonatomic) IBOutlet UIButton *ok;

@property (nonatomic, assign) int timeCount;
@property (nonatomic, strong) NSTimer *timer;
@end

@implementation CSFullNavVC

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    if ([[ADModule standardInstance]haveNavAd]){
        self.navView.hidden = false;
        [[ADModule standardInstance]showBigNavAd:self.navView];
    }else{
        
    }
    

}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.timeCount = 2;
    
    if (!self.timer){
        self.timer = [NSTimer timerWithTimeInterval:1 repeats:YES block:^(NSTimer * _Nonnull timer) {
            self.timeCount --;
//            self.timerLabel.text = [NSString stringWithFormat:@"%ds",self.timeCount];
            if (self.timeCount == 0){
                [self.timer invalidate];
                self.timer = nil;
                self.ok.hidden = NO;
            }
            
        }];
        [[NSRunLoop currentRunLoop]addTimer:self.timer forMode:NSRunLoopCommonModes];
    }
    

}

- (IBAction)close:(id)sender {
    self.closeBlock ? self.closeBlock() : nil;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
